package com.easymin.weixin.entity.passenger;

import com.alibaba.fastjson.annotation.JSONField;
import org.apache.commons.lang3.BooleanUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

public class Passenger implements Serializable {

    public static final String PASSENGER_CHANNEL_PHONE = "电话预约";
    public static final String PASSENGER_CHANNEL_APP = "APP预约";
    public static final String PASSENGER_CHANNEL_WEIXIN = "微信预约";
    public static final String PASSENGER_CHANNEL_WEB = "网站预约";
    public static final String PASSENGER_CHANNEL_BUDAN = "司机补单";
    public static final String PASSENGER_CHANNEL_INVITE = "推荐";

    public boolean canBindIntroducer(){
        return !channel_name.equals(PASSENGER_CHANNEL_APP) &&
                !channel_name.equals(PASSENGER_CHANNEL_WEIXIN) &&
                !channel_name.equals(PASSENGER_CHANNEL_INVITE);
    }

    private Long id;

    private String name;// 乘客姓名

    private String phone;// 乘客电话

    private Boolean allowOverdraw;// 是否允许签单

    private Double drawMoney;// 可提现金额

    private Double nodrawMoney;// 不可提现金额

    private Double frozenMoney;// 冻结金额

    private Double receiptMoney;// 可开票金额

    private Long enterprise_id;// 所属企业Id

    private String enterprise_name;// 所属企业名称

    private String plateNumber;// 车牌号

    private String photo;// 头像地址

    private Long grade_id;// 级别Id

    private String grade_name;// 级别名称

    private Boolean inBlackList;// 是否为黑名单乘客

    private Integer type;// 类型:0个人,1企业

    private String idcard;// 身份证号码

    private Integer gender;// 性别

    private String email;// 邮箱

    private String memo;// 备注

    private Double latitude;// 纬度

    private Double longitude;// 经度

    private Long drivingNumberTimes;// 代驾次数

    private String deviceType; // 设备类型

    private PassengerGrade passengerGrade;

    private Object other; // 存储其他信息，微信V5版本新加

    private String wxHeadImgUrl;

    private String wxNickName;

    public PassengerGrade getPassengerGrade() {
        return passengerGrade;
    }

    public void setPassengerGrade(PassengerGrade passengerGrade) {
        this.passengerGrade = passengerGrade;
    }

    public String getDeviceType() {
        return deviceType;
    }

    public void setDeviceType(String deviceType) {
        this.deviceType = deviceType;
    }

    public Double getReceiptMoney() {
        return receiptMoney;
    }

    public void setReceiptMoney(Double receiptMoney) {
        this.receiptMoney = receiptMoney;
    }

    private String address;// 简单地址:如(翰林世家)
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date created; // 注册时间
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date updated;

    private Integer version;// 操作版本

    private Long channel_id;// 渠道Id

    private String channel_name;// 渠道名称

    private String appKey;// 用于区别系统

    private Long companyId;// 所属公司Id

    private String companyName;// 所属公司名称

    private String introducer;// 推荐人

    private Integer introduceType;// 推荐人类型：0客户,1司机

    private String appVersion;// app版本

    private static final long serialVersionUID = 1L;


    public String getAppVersion() {
        return appVersion;
    }

    public void setAppVersion(String appVersion) {
        this.appVersion = appVersion;
    }

    public Long getDrivingNumberTimes() {
        return drivingNumberTimes;
    }

    public void setDrivingNumberTimes(Long drivingNumberTimes) {
        this.drivingNumberTimes = drivingNumberTimes;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name != null ? name : "";
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public String getPhone() {
        return phone != null ? phone : "";
    }

    public void setPhone(String phone) {
        this.phone = phone == null ? null : phone.trim();
    }

    public Boolean getAllowOverdraw() {
        return BooleanUtils.toBoolean(allowOverdraw);
    }

    public void setAllowOverdraw(Boolean allowOverdraw) {
        this.allowOverdraw = allowOverdraw;
    }

    public Double getDrawMoney() {
        return drawMoney != null ? drawMoney : 0.0;
    }

    public void setDrawMoney(Double drawMoney) {
        this.drawMoney = drawMoney;
    }

    public Double getNodrawMoney() {
        return nodrawMoney != null ? nodrawMoney : 0.0;
    }

    public void setNodrawMoney(Double nodrawMoney) {
        this.nodrawMoney = nodrawMoney;
    }

    public Double getFrozenMoney() {
        return frozenMoney != null ? frozenMoney : 0.0;
    }

    public void setFrozenMoney(Double frozenMoney) {
        this.frozenMoney = frozenMoney;
    }

    public Long getEnterprise_id() {
        return enterprise_id;
    }

    public void setEnterprise_id(Long enterprise_id) {
        this.enterprise_id = enterprise_id;
    }

    public String getEnterprise_name() {
        return enterprise_name != null ? enterprise_name : "";
    }

    public void setEnterprise_name(String enterprise_name) {
        this.enterprise_name = enterprise_name == null ? null : enterprise_name.trim();
    }

    public String getPlateNumber() {
        return plateNumber != null ? plateNumber : "";
    }

    public void setPlateNumber(String plateNumber) {
        this.plateNumber = plateNumber == null ? null : plateNumber.trim();
    }

    public String getPhoto() {
        return photo != null ? photo : "";
    }

    public void setPhoto(String photo) {
        this.photo = photo == null ? null : photo.trim();
    }

    public Long getGrade_id() {
        return grade_id;
    }

    public void setGrade_id(Long grade_id) {
        this.grade_id = grade_id;
    }

    public String getGrade_name() {
        return grade_name != null ? grade_name : "";
    }

    public void setGrade_name(String grade_name) {
        this.grade_name = grade_name == null ? null : grade_name.trim();
    }

    public Boolean getInBlackList() {
        return inBlackList;
    }

    public void setInBlackList(Boolean inBlackList) {
        this.inBlackList = inBlackList;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getIdcard() {
        return idcard;
    }

    public void setIdcard(String idcard) {
        this.idcard = idcard == null ? null : idcard.trim();
    }

    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }

    public String getWxHeadImgUrl() {
        return wxHeadImgUrl;
    }

    public void setWxHeadImgUrl(String wxHeadImgUrl) {
        this.wxHeadImgUrl = wxHeadImgUrl;
    }

    public String getWxNickName() {
        return wxNickName;
    }

    public void setWxNickName(String wxNickName) {
        this.wxNickName = wxNickName;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email == null ? null : email.trim();
    }

    public String getMemo() {
        return memo;
    }

    public void setMemo(String memo) {
        this.memo = memo == null ? null : memo.trim();
    }

    public Double getLatitude() {
        return latitude;
    }

    public void setLatitude(Double latitude) {
        this.latitude = latitude;
    }

    public Double getLongitude() {
        return longitude;
    }

    public void setLongitude(Double longitude) {
        this.longitude = longitude;
    }

    public String getAddress() {
        return address != null ? address : "";
    }

    public void setAddress(String address) {
        this.address = address == null ? null : address.trim();
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public Date getUpdated() {
        return updated;
    }

    public void setUpdated(Date updated) {
        this.updated = updated;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public Long getChannel_id() {
        return channel_id;
    }

    public void setChannel_id(Long channel_id) {
        this.channel_id = channel_id;
    }

    public String getChannel_name() {
        return channel_name != null ? channel_name : "";
    }

    public void setChannel_name(String channel_name) {
        this.channel_name = channel_name == null ? null : channel_name.trim();
    }

    public String getAppKey() {
        return appKey;
    }

    public void setAppKey(String appKey) {
        this.appKey = appKey == null ? null : appKey.trim();
    }

    public Long getCompanyId() {
        return companyId;
    }

    public void setCompanyId(Long companyId) {
        this.companyId = companyId;
    }

    public String getCompanyName() {
        return companyName != null ? companyName : "";
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName == null ? null : companyName.trim();
    }

    public String getIntroducer() {
        return introducer;
    }

    public void setIntroducer(String introducer) {
        this.introducer = introducer == null ? null : introducer.trim();
    }

    public Integer getIntroduceType() {
        return introduceType;
    }

    public void setIntroduceType(Integer introduceType) {
        this.introduceType = introduceType;
    }

    public Object getOther() {
        return other;
    }

    public void setOther(Object other) {
        this.other = other;
    }


    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Passenger other = (Passenger) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
                && (this.getName() == null ? other.getName() == null : this.getName().equals(
                other.getName()))
                && (this.getPhone() == null ? other.getPhone() == null : this.getPhone().equals(
                other.getPhone()))
                && (this.getAllowOverdraw() == null ? other.getAllowOverdraw() == null : this
                .getAllowOverdraw().equals(other.getAllowOverdraw()))
                && (this.getDrawMoney() == null ? other.getDrawMoney() == null : this.getDrawMoney()
                .equals(other.getDrawMoney()))
                && (this.getNodrawMoney() == null ? other.getNodrawMoney() == null : this.getNodrawMoney()
                .equals(other.getNodrawMoney()))
                && (this.getFrozenMoney() == null ? other.getFrozenMoney() == null : this.getFrozenMoney()
                .equals(other.getFrozenMoney()))
                && (this.getEnterprise_id() == null ? other.getEnterprise_id() == null : this
                .getEnterprise_id().equals(other.getEnterprise_id()))
                && (this.getEnterprise_name() == null ? other.getEnterprise_name() == null : this
                .getEnterprise_name().equals(other.getEnterprise_name()))
                && (this.getPlateNumber() == null ? other.getPlateNumber() == null : this.getPlateNumber()
                .equals(other.getPlateNumber()))
                && (this.getPhoto() == null ? other.getPhoto() == null : this.getPhoto().equals(
                other.getPhoto()))
                && (this.getGrade_id() == null ? other.getGrade_id() == null : this.getGrade_id().equals(
                other.getGrade_id()))
                && (this.getGrade_name() == null ? other.getGrade_name() == null : this.getGrade_name()
                .equals(other.getGrade_name()))
                && (this.getInBlackList() == null ? other.getInBlackList() == null : this.getInBlackList()
                .equals(other.getInBlackList()))
                && (this.getType() == null ? other.getType() == null : this.getType().equals(
                other.getType()))
                && (this.getIdcard() == null ? other.getIdcard() == null : this.getIdcard().equals(
                other.getIdcard()))
                && (this.getGender() == null ? other.getGender() == null : this.getGender().equals(
                other.getGender()))
                && (this.getEmail() == null ? other.getEmail() == null : this.getEmail().equals(
                other.getEmail()))
                && (this.getMemo() == null ? other.getMemo() == null : this.getMemo().equals(
                other.getMemo()))
                && (this.getLatitude() == null ? other.getLatitude() == null : this.getLatitude().equals(
                other.getLatitude()))
                && (this.getLongitude() == null ? other.getLongitude() == null : this.getLongitude()
                .equals(other.getLongitude()))
                && (this.getAddress() == null ? other.getAddress() == null : this.getAddress().equals(
                other.getAddress()))
                && (this.getCreated() == null ? other.getCreated() == null : this.getCreated().equals(
                other.getCreated()))
                && (this.getUpdated() == null ? other.getUpdated() == null : this.getUpdated().equals(
                other.getUpdated()))
                && (this.getVersion() == null ? other.getVersion() == null : this.getVersion().equals(
                other.getVersion()))
                && (this.getChannel_id() == null ? other.getChannel_id() == null : this.getChannel_id()
                .equals(other.getChannel_id()))
                && (this.getChannel_name() == null ? other.getChannel_name() == null : this
                .getChannel_name().equals(other.getChannel_name()))
                && (this.getAppKey() == null ? other.getAppKey() == null : this.getAppKey().equals(
                other.getAppKey()))
                && (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId()
                .equals(other.getCompanyId()))
                && (this.getCompanyName() == null ? other.getCompanyName() == null : this.getCompanyName()
                .equals(other.getCompanyName()))
                && (this.getIntroducer() == null ? other.getIntroducer() == null : this.getIntroducer()
                .equals(other.getIntroducer()))
                && (this.getIntroduceType() == null ? other.getIntroduceType() == null : this
                .getIntroduceType().equals(other.getIntroduceType()))
                && (this.getWxHeadImgUrl() == null ? other.getWxHeadImgUrl() == null : this
                .getWxHeadImgUrl().equals(other.getWxHeadImgUrl()))
                && (this.getWxNickName() == null ? other.getWxNickName() == null : this
                .getWxNickName().equals(other.getWxNickName()))
                ;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getPhone() == null) ? 0 : getPhone().hashCode());
        result = prime * result + ((getAllowOverdraw() == null) ? 0 : getAllowOverdraw().hashCode());
        result = prime * result + ((getDrawMoney() == null) ? 0 : getDrawMoney().hashCode());
        result = prime * result + ((getNodrawMoney() == null) ? 0 : getNodrawMoney().hashCode());
        result = prime * result + ((getFrozenMoney() == null) ? 0 : getFrozenMoney().hashCode());
        result = prime * result + ((getEnterprise_id() == null) ? 0 : getEnterprise_id().hashCode());
        result =
                prime * result + ((getEnterprise_name() == null) ? 0 : getEnterprise_name().hashCode());
        result = prime * result + ((getPlateNumber() == null) ? 0 : getPlateNumber().hashCode());
        result = prime * result + ((getPhoto() == null) ? 0 : getPhoto().hashCode());
        result = prime * result + ((getGrade_id() == null) ? 0 : getGrade_id().hashCode());
        result = prime * result + ((getGrade_name() == null) ? 0 : getGrade_name().hashCode());
        result = prime * result + ((getInBlackList() == null) ? 0 : getInBlackList().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getIdcard() == null) ? 0 : getIdcard().hashCode());
        result = prime * result + ((getGender() == null) ? 0 : getGender().hashCode());
        result = prime * result + ((getEmail() == null) ? 0 : getEmail().hashCode());
        result = prime * result + ((getMemo() == null) ? 0 : getMemo().hashCode());
        result = prime * result + ((getLatitude() == null) ? 0 : getLatitude().hashCode());
        result = prime * result + ((getLongitude() == null) ? 0 : getLongitude().hashCode());
        result = prime * result + ((getAddress() == null) ? 0 : getAddress().hashCode());
        result = prime * result + ((getCreated() == null) ? 0 : getCreated().hashCode());
        result = prime * result + ((getUpdated() == null) ? 0 : getUpdated().hashCode());
        result = prime * result + ((getVersion() == null) ? 0 : getVersion().hashCode());
        result = prime * result + ((getChannel_id() == null) ? 0 : getChannel_id().hashCode());
        result = prime * result + ((getChannel_name() == null) ? 0 : getChannel_name().hashCode());
        result = prime * result + ((getAppKey() == null) ? 0 : getAppKey().hashCode());
        result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode());
        result = prime * result + ((getCompanyName() == null) ? 0 : getCompanyName().hashCode());
        result = prime * result + ((getIntroducer() == null) ? 0 : getIntroducer().hashCode());
        result = prime * result + ((getIntroduceType() == null) ? 0 : getIntroduceType().hashCode());
        result = prime * result + ((getWxHeadImgUrl() == null) ? 0 : getWxHeadImgUrl().hashCode());
        result = prime * result + ((getWxNickName() == null) ? 0 : getWxNickName().hashCode());
        return result;
    }

    @Override
    public String toString() {
        return "Passenger{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", phone='" + phone + '\'' +
                ", allowOverdraw=" + allowOverdraw +
                ", drawMoney=" + drawMoney +
                ", nodrawMoney=" + nodrawMoney +
                ", frozenMoney=" + frozenMoney +
                ", receiptMoney=" + receiptMoney +
                ", enterprise_id=" + enterprise_id +
                ", enterprise_name='" + enterprise_name + '\'' +
                ", plateNumber='" + plateNumber + '\'' +
                ", photo='" + photo + '\'' +
                ", grade_id=" + grade_id +
                ", grade_name='" + grade_name + '\'' +
                ", inBlackList=" + inBlackList +
                ", type=" + type +
                ", idcard='" + idcard + '\'' +
                ", gender=" + gender +
                ", email='" + email + '\'' +
                ", memo='" + memo + '\'' +
                ", latitude=" + latitude +
                ", longitude=" + longitude +
                ", drivingNumberTimes=" + drivingNumberTimes +
                ", deviceType='" + deviceType + '\'' +
                ", passengerGrade=" + passengerGrade +
                ", other=" + other +
                ", wxHeadImgUrl='" + wxHeadImgUrl + '\'' +
                ", wxNickName='" + wxNickName + '\'' +
                ", address='" + address + '\'' +
                ", created=" + created +
                ", updated=" + updated +
                ", version=" + version +
                ", channel_id=" + channel_id +
                ", channel_name='" + channel_name + '\'' +
                ", appKey='" + appKey + '\'' +
                ", companyId=" + companyId +
                ", companyName='" + companyName + '\'' +
                ", introducer='" + introducer + '\'' +
                ", introduceType=" + introduceType +
                ", appVersion='" + appVersion + '\'' +
                '}';
    }

    //
//  @Override
//  public String toString() {
//    StringBuilder sb = new StringBuilder();
//    sb.append(getClass().getSimpleName());
//    sb.append(" [");
//    sb.append("Hash = ").append(hashCode());
//    sb.append(", id=").append(id);
//    sb.append(", name=").append(name);
//    sb.append(", phone=").append(phone);
//    sb.append(", allowOverdraw=").append(allowOverdraw);
//    sb.append(", drawMoney=").append(drawMoney);
//    sb.append(", nodrawMoney=").append(nodrawMoney);
//    sb.append(", frozenMoney=").append(frozenMoney);
//    sb.append(", enterprise_id=").append(enterprise_id);
//    sb.append(", enterprise_name=").append(enterprise_name);
//    sb.append(", plateNumber=").append(plateNumber);
//    sb.append(", photo=").append(photo);
//    sb.append(", grade_id=").append(grade_id);
//    sb.append(", grade_name=").append(grade_name);
//    sb.append(", inBlackList=").append(inBlackList);
//    sb.append(", type=").append(type);
//    sb.append(", idcard=").append(idcard);
//    sb.append(", gender=").append(gender);
//    sb.append(", email=").append(email);
//    sb.append(", memo=").append(memo);
//    sb.append(", latitude=").append(latitude);
//    sb.append(", longitude=").append(longitude);
//    sb.append(", address=").append(address);
//    sb.append(", created=").append(created);
//    sb.append(", updated=").append(updated);
//    sb.append(", version=").append(version);
//    sb.append(", channel_id=").append(channel_id);
//    sb.append(", channel_name=").append(channel_name);
//    sb.append(", appKey=").append(appKey);
//    sb.append(", companyId=").append(companyId);
//    sb.append(", companyName=").append(companyName);
//    sb.append(", introducer=").append(introducer);
//    sb.append(", introduceType=").append(introduceType);
//    sb.append(", serialVersionUID=").append(serialVersionUID);
//    sb.append("]");
//    return sb.toString();
//  }
}
